from nicegui import ui
from ex4nicegui import bi
import pandas as pd

df = pd.DataFrame(
    {
        "name": list("aabcdf"),
        "cls": ["c1", "c2", "c1", "c1", "c3", None],
        "value": range(6),
    }
)
df1 = pd.DataFrame(
    {
        "name": list("rico"),
        "cls": ["r1", "r2", "61", "51"],
        "value": range(4),
    }
)

ds = bi.data_source(df)


@bi.data_source
def new_ds():
    # df is pd.DataFrame
    df = ds.filtered_data
    df = df.copy()
    df["value"] = df["value"] * 100
    return df


ds.ui_select("name")

new_ds.ui_aggrid()


ui.run()

if __name__ == "__main__":
    current_directory = os.path.dirname(os.path.realpath(__file__))
